import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'

export const MENU_ROUTER: RouteRecordRaw[] = [
  {
    path: '/',
    meta: {
      title: '首页'
    },
    component: () => import("@/views/home/index.vue")
  },
  {
    path: '/list',
    meta: {
      title: '用户信息'
    },
    children: [
      {
        path: '/list/listAdd',
        meta: {
          title: '列表添加'
        },
        component: () => import("@/views/listAdd/index.vue")
      },
      {
        path: '/list/listEmit',
        meta: {
          title: '列表编辑'
        },
        component: () => import("@/views/listEmid/index.vue")
      }
    ]
  },
  {
    path: '/my',
    meta: {
      title: '我的'
    },
    component: () => import("@/views/my/index.vue")
  },
]


const LIST_ROUTER: RouteRecordRaw[] = [
  {
    path: '/',
    component: () => import("@/views/layout/index.vue"),
    children: MENU_ROUTER
  },
  {
    path: '/login',
    component: () => import("@/views/login/index.vue")
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: LIST_ROUTER
})

export default router
